wayland: Update cursor surface scale when output scale changes
authorJonas Ådahl <jadahl@gmail.com>
Thu, 28 Jun 2018 10:44:22 +0000 (12:44 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Thu, 28 Jun 2018 10:44:22 +0000 (12:44 +0200)
Also update the cursor surfaces of every seat when an output changes
scale. This could for example happen when a monitor scale is changed via
Settings.

gdk/wayland/gdkdevice-wayland.c
gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdkseat-wayland.h

index 9c9b79b5635bd251282a797fd89610d44b9d752a..64ab005aeda038555cb4a8b181b89a0474bf8e2f 100644 (file)
@@ -4516,6 +4516,12 @@ pointer_surface_update_scale (GdkDevice *device)
   gdk_wayland_device_update_surface_cursor (device);
 }
 
+void
+gdk_wayland_seat_update_cursor_scale (GdkWaylandSeat *seat)
+{
+  pointer_surface_update_scale (seat->master_pointer);
+}
+
 static void
 pointer_surface_enter (void              *data,
                        struct wl_surface *wl_surface,
index b64f2f105b0ec9ee355ba6f7bcde6547cb8bef0d..c4c710847af539f266c9ff06aaa5af360075cb22 100644 (file)
@@ -38,6 +38,7 @@
 #include "gdkdisplay.h"
 #include "gdkdisplay-wayland.h"
 #include "gdkmonitor-wayland.h"
+#include "gdkseat-wayland.h"
 #include "gdkinternals.h"
 #include "gdkdeviceprivate.h"
 #include "gdkkeysprivate.h"
@@ -1871,9 +1872,20 @@ transform_to_string (int transform)
 static void
 update_scale (GdkDisplay *display)
 {
+  GList *seats;
+  GList *l;
+
   g_list_foreach (gdk_wayland_display_get_toplevel_surfaces (display),
                   (GFunc)gdk_wayland_surface_update_scale,
                   NULL);
+  seats = gdk_display_list_seats (display);
+  for (l = seats; l; l = l->next)
+    {
+      GdkSeat *seat = l->data;
+
+      gdk_wayland_seat_update_cursor_scale (GDK_WAYLAND_SEAT (seat));
+    }
+  g_list_free (seats);
 }
 
 static void
index 52c73e22eebb1ef22a6d78f0346be3d285dba5eb..eccc79281764e134896eab3fde017a130bf990d0 100644 (file)
@@ -41,4 +41,6 @@ struct _GdkWaylandSeatClass
 
 GType gdk_wayland_seat_get_type (void) G_GNUC_CONST;
 
+void gdk_wayland_seat_update_cursor_scale (GdkWaylandSeat *seat);
+
 #endif /* __GDK_WAYLAND_SEAT_H__ */